package com.jrx.anytxn.param.mapper.ext;

import com.jrx.anytxn.param.entity.TlBillTransCompareDetail;
import com.jrx.anytxn.param.entity.TlBillTransDetil;
import com.jrx.anytxn.param.mapper.base.TlBillTransCompareDetailMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface ExtTlBillTransCompareDetailMapper extends TlBillTransCompareDetailMapper {

    /**
     * 保存
     *
     * @param item
     * @return int
     */
    int insertbatch(List<TlBillTransCompareDetail> item);

    /**
     * 根据商户订单查询
     *
     * @param loanNumber
     * @return TlBillTransDetil
     */
    TlBillTransDetil selectByLoanNumber(String loanNumber);

    int countByTenantIdBusDateAndCompareStatus(@Param("tenantId") String tenantId,
                                               @Param("businessDate") Date businessDate,
                                               @Param("compareStatus") String compareStatus);

    int countByTenantIdBusDateAndCompareStatusAndThirdChannel(@Param("tenantId") String tenantId,
                                                              @Param("businessDate") Date businessDate,
                                                              @Param("compareStatus") String compareStatus,
                                                              @Param("thirdChannel") String thirdChannel);

    /**
     * 根据业务日期及分库信息删除当日差异对账明细
     *
     * @param dataFrom     String
     * @param businessDate Date
     * @return int
     */
    int deleteDiffRecordByFromAndBusDate(@Param("dataFrom") String dataFrom,
                                         @Param("businessDate") Date businessDate);

    int deleteDiffRecordByFromAndBusDateAndThirdChannel(
            @Param("dataFrom") String dataFrom,
            @Param("businessDate") Date businessDate,
            @Param("thirdChannel") String thirdChannel);

    /**
     * 根据业务日期删除当日未匹配对账明细
     *
     * @param businessDate Date
     * @return int
     */
    int deleteUmMatchRecordByBusDate(@Param("businessDate") Date businessDate);

    /**
     * 监听
     * 根据业务日期删除当日未匹配对账明细
     *
     * @param businessDate Date
     * @return int
     */
    int deleteUmMatchRecordByBusDateAndThirdChannel(@Param("businessDate") Date businessDate, @Param("thirdChannel") String thirdChannel);


    List<TlBillTransCompareDetail> selectByCompareStatus(@Param("tenantId") String tenantId,
                                                         @Param("compareStatus") String compareStatus);

    TlBillTransCompareDetail selectById(@Param("tenantId") String tenantId,
                                        @Param("thirdChannel") String thirdChannel,
                                        @Param("id") Long id);

    void updateCompareStatusById(@Param("tenantId") String tenantId,
                                 @Param("compareStatus") String compareStatus,
                                 @Param("desc") String desc,
                                 @Param("id") Long id);
}
